<?php

class Cat_Tags_Php_Attr_Prop_Setter_Impl extends Cat_Processor_Monkey_TagBase
{
	function getOutput()
	{
		$args = $this->getArgs();
			
		$defaults = array(
			'name' => 'name',
			'value' => 'value'
		);
		
		$args = Cat_Common::withDefaults( $args, $defaults );
		
		$schema = array(
			0 => 'string',
			'name' => 'string',
			'value' => 'string'
		);
		
		Cat_Common::checkArgs( $args, $schema );
		
		$code = '';

		foreach( explode(',', $args[0]) as $var )
		{		
			$setter = 'set' . Cat_Strings::camelize( $var ) . "(\${$args['value']})";			
			$code .= "if(\${$args['name']}=='{$var}'){\$this->{$setter}; return;}\n";
		}
		
		return $code;
	}
}